typedef (*command)();

char		commandNames[10][10] = { "ps", "chname", "kmode", "kswitch", 
				"wait", "exit", "fork", "exec", "help", "pipe" };
command		commands[10] = { ps, chname, kmode, kswitch, wait, exit, fork, exec, help, upipe};

void main()
{
	int i = 0;
	char cmd[20];
	while (1)
	{
		printf("\n*****************************************************\n");
		printf("In the user space! My PID = %d", getpid());
		printf("\n*****************************************************\n");
		printf("Input Command: ");
		
		gets(cmd);
		printf("Running\n");
		
		printf("\n\n");
		for (i = 0; i < 10; ++i)
		{
			if (strcmp(commandNames[i], cmd) == 0)
			{
				(*commands[i])("");
				break;
			}
		}
	}
}
